// 基础错误类型定义

use thiserror::Error;

// FFI错误类型
#[derive(Error, Debug)]
#[non_exhaustive]
pub enum FFIError {
    #[error("Null pointer")]
    NullPointer,
    
    #[error("Buffer too small")]
    BufferTooSmall,
    
    #[error("Invalid parameter")]
    InvalidParameter,
    
    #[error("Memory allocation failed")]
    MemoryAllocationFailed,
    
    #[error("Operation failed")]
    OperationFailed,
    
    #[error("Lock error")]
    LockError,
    
    #[error("Other error: {0}")]
    Other(String),
}

// 通用结果类型
pub type FFIResult<T> = Result<T, FFIError>;